package cn.mbz.blog.admin.webapi.controller;

import cn.mbz.blog.admin.service.IAdminService;
import cn.mbz.blog.commons.pojo.dto.AdminSimpleDTO;
import cn.mbz.blog.commons.pojo.vo.AdminSimpleVO;
import cn.mbz.blog.commons.web.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/admins",produces = "application/json; charset=utf-8")
public class AdminController {

    @Autowired
    IAdminService service;

    @PostMapping("/add/admin")
    public JsonResult<Void> addAdmin(AdminSimpleDTO adminSimpleDTO){
        service.addAdmin(adminSimpleDTO);
        return JsonResult.ok();
    }

    @PostMapping("/add/admin_role")
    public JsonResult<Void> addAdminRole(String adminName,String roleName){
        service.addAdminRole(adminName,roleName);
        return JsonResult.ok();
    }
}
